package player

import (
	"GameServer/Game/errors"
	"GameServer/Game/lib"
	"GameServer/Game/sp"
)

// 兑换码 8650
func (p *Player) ExchangeCodeRequest(req *sp.ExchangeCodeRequest) (res *sp.ExchangeCodeResponse, err error) {
	resGoods, err := lib.ExchangeProp(p.User, req.ExCode)
	if err != nil {
		res = &sp.ExchangeCodeResponse{
			Errcode: errors.ErrCode(err),
		}
		return
	}
	SendMailToUid(p.User.Uid.Hex(), "Redeem Code Reward", "Congratulations! Please claim your redeem code reward.", resGoods)
	res = &sp.ExchangeCodeResponse{}
	return
}
